#ifndef MYSQL_MYSQL_RELATIONSHIP_H
#define MYSQL_MYSQL_RELATIONSHIP_H

#include <memory>
#include <odb/database.hxx>
#include <odb/mysql/database.hxx>
#include <string>
#include <vector>

#include "database_factory.h"
#include "relationship.hxx"

namespace chat {
class RelationshipTable {
   public:
    RelationshipTable(const std::shared_ptr<odb::mysql::database>& db)
        : db_(db) {}

    bool insert(const std::string& user_id, const std::string& peer_id);
    bool remove(const std::string& user_id, const std::string& peer_id);
    bool exist(const std::string& user_id, const std::string& peer_id);
    std::vector<std::string> friends(const std::string& user_id);

   private:
    std::shared_ptr<odb::mysql::database> db_ = nullptr;
};
using RelationshipTablePtr = std::shared_ptr<RelationshipTable>;
}  // namespace chat

#endif  // MYSQL_MYSQL_RELATIONSHIP_H
